﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UDDL.Model
{
	public abstract class Item
	{
		protected Item(String name)
		{
			Name = name;
		}

		protected delegate Item ItemCreator();

		protected Item GetSubItem(String name)
		{
			Item result;
			if (!m_subItems.TryGetValue(name, out result))
				return null;
			return result;
		}
		protected void AddSubItem(Item item)
		{
			m_subItems.Add(item.Name, item);
		}

		public String Name { get; private set; }
		private Dictionary<String, Item> m_subItems = new Dictionary<String, Item>();
	}
}
